<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>JSDoc: Class: BinaryObject</title>

    <script src="scripts/prettify/prettify.js"> </script>
    <script src="scripts/prettify/lang-css.js"> </script>
    <!--[if lt IE 9]>
      <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
    <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>

<body>

<div id="main">

    <h1 class="page-title">Class: BinaryObject</h1>

    




<section>

<header>
    
        <h2><span class="attribs"><span class="type-signature"></span></span>BinaryObject<span class="signature">(typeName)</span><span class="type-signature"></span></h2>
        
            <div class="class-description"><p>Class representing a complex Ignite object in the binary form.</p>
<p>It corresponds to COMPOSITE_TYPE.COMPLEX_OBJECT <a href="ObjectType.html#.COMPOSITE_TYPE">ObjectType.COMPOSITE_TYPE</a>,
has mandatory type Id, which corresponds to a name of the complex type,
and includes optional fields.</p>
<p>An instance of the BinaryObject can be obtained/created by the following ways:</p>
<ul>
<li>returned by the client when a complex object is received from Ignite cache
and is not deserialized to another JavaScript object.</li>
<li>created using the public constructor. Fields may be added to such an instance using setField() method.</li>
<li>created from a JavaScript object using static fromObject() method.</li>
</ul></div>
        
    
</header>

<article>
    <div class="container-overview">
    
        

    
    <h2>Constructor</h2>
    

    
    <h4 class="name" id="BinaryObject"><span class="type-signature"></span>new BinaryObject<span class="signature">(typeName)</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    <p>Creates an instance of the BinaryObject without any fields.</p>
<p>Fields may be added later using setField() method.</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>typeName</code></td>
            

            <td class="type">
            
                
<span class="param-type">string</span>


            
            </td>

            

            

            <td class="description last"><p>name of the complex type to generate the type Id.</p></td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="BinaryObject.js.html">BinaryObject.js</a>, <a href="BinaryObject.js.html#line61">line 61</a>
    </li></ul></dd>
    

    

    

    
</dl>


















    
    </div>

    

    

    

    

    

    

    

    
        <h3 class="subsection-title">Methods</h3>

        
            

    

    
    <h4 class="name" id=".fromObject"><span class="type-signature">(async, static) </span>fromObject<span class="signature">(jsObject, complexObjectType<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {<a href="BinaryObject.html">BinaryObject</a>}</span></h4>
    

    



<div class="description">
    <p>Creates an instance of the BinaryObject from the specified instance of JavaScript Object.</p>
<p>All fields of the JavaScript Object instance with their values are added to the BinaryObject.
Fields may be added or removed later using setField() and removeField() methods.</p>
<p>If complexObjectType parameter is specified, then the type Id is taken from it.
Otherwise, the type Id is generated from the name of the JavaScript Object.</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        
        <th>Attributes</th>
        

        
        <th>Default</th>
        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>jsObject</code></td>
            

            <td class="type">
            
                
<span class="param-type">object</span>


            
            </td>

            
                <td class="attributes">
                

                

                
                </td>
            

            
                <td class="default">
                
                </td>
            

            <td class="description last"><p>instance of JavaScript Object
  which adds and initializes the fields of the BinaryObject instance.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>complexObjectType</code></td>
            

            <td class="type">
            
                
<span class="param-type"><a href="ComplexObjectType.html">ComplexObjectType</a></span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            
                <td class="default">
                
                    null
                
                </td>
            

            <td class="description last"><p>instance of complex type definition
  which specifies non-standard mapping of the fields of the BinaryObject instance
  to/from the Ignite types.</p></td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="BinaryObject.js.html">BinaryObject.js</a>, <a href="BinaryObject.js.html#line105">line 105</a>
    </li></ul></dd>
    

    

    

    
</dl>











<h5>Throws:</h5>

        

<dl>
    <dt>
        <div class="param-desc">
        <p>if error.</p>
        </div>
    </dt>
    <dd></dd>
    <dt>
        <dl>
            <dt>
                Type
            </dt>
            <dd>
                
<span class="param-type"><a href="IgniteClientError.html">IgniteClientError</a></span>


            </dd>
        </dl>
    </dt>
    <dd></dd>
</dl>


    


<h5>Returns:</h5>

        
<div class="param-desc">
    <ul>
<li>new BinaryObject instance.</li>
</ul>
</div>



<dl>
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type"><a href="BinaryObject.html">BinaryObject</a></span>


    </dd>
</dl>

    





        
            

    

    
    <h4 class="name" id="getField"><span class="type-signature">(async) </span>getField<span class="signature">(fieldName, fieldType<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {*}</span></h4>
    

    



<div class="description">
    <p>Returns a value of the specified field.</p>
<p>Optionally, specifies a type of the field.
If the type is not specified then the Ignite client
will try to make automatic mapping between JavaScript types and Ignite object types -
according to the mapping table defined in the description of the <a href="ObjectType.html">ObjectType</a> class.</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        
        <th>Attributes</th>
        

        
        <th>Default</th>
        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>fieldName</code></td>
            

            <td class="type">
            
                
<span class="param-type">string</span>


            
            </td>

            
                <td class="attributes">
                

                

                
                </td>
            

            
                <td class="default">
                
                </td>
            

            <td class="description last"><p>name of the field.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>fieldType</code></td>
            

            <td class="type">
            
                
<span class="param-type"><a href="ObjectType.html#.PRIMITIVE_TYPE">ObjectType.PRIMITIVE_TYPE</a></span>
|

<span class="param-type"><a href="CompositeType.html">CompositeType</a></span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            
                <td class="default">
                
                    null
                
                </td>
            

            <td class="description last"><p>type of the field:</p>
<ul>
<li>either a type code of primitive (simple) type</li>
<li>or an instance of class representing non-primitive (composite) type</li>
<li>or null (or not specified) that means the type is not specified.</li>
</ul></td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="BinaryObject.js.html">BinaryObject.js</a>, <a href="BinaryObject.js.html#line209">line 209</a>
    </li></ul></dd>
    

    

    

    
</dl>











<h5>Throws:</h5>

        

<dl>
    <dt>
        <div class="param-desc">
        <p>if error.</p>
        </div>
    </dt>
    <dd></dd>
    <dt>
        <dl>
            <dt>
                Type
            </dt>
            <dd>
                
<span class="param-type"><a href="IgniteClientError.html">IgniteClientError</a></span>


            </dd>
        </dl>
    </dt>
    <dd></dd>
</dl>


    


<h5>Returns:</h5>

        
<div class="param-desc">
    <ul>
<li>value of the field or JavaScript undefined if the field does not exist.</li>
</ul>
</div>



<dl>
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">*</span>


    </dd>
</dl>

    





        
            

    

    
    <h4 class="name" id="getFieldNames"><span class="type-signature"></span>getFieldNames<span class="signature">()</span><span class="type-signature"> &rarr; {Array.&lt;string>}</span></h4>
    

    



<div class="description">
    <p>Returns names of all fields of this BinaryObject instance.</p>
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="BinaryObject.js.html">BinaryObject.js</a>, <a href="BinaryObject.js.html#line261">line 261</a>
    </li></ul></dd>
    

    

    

    
</dl>











<h5>Throws:</h5>

        

<dl>
    <dt>
        <div class="param-desc">
        <p>if error.</p>
        </div>
    </dt>
    <dd></dd>
    <dt>
        <dl>
            <dt>
                Type
            </dt>
            <dd>
                
<span class="param-type"><a href="IgniteClientError.html">IgniteClientError</a></span>


            </dd>
        </dl>
    </dt>
    <dd></dd>
</dl>


    


<h5>Returns:</h5>

        
<div class="param-desc">
    <ul>
<li>names of all fields.</li>
</ul>
</div>



<dl>
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">Array.&lt;string></span>


    </dd>
</dl>

    





        
            

    

    
    <h4 class="name" id="getTypeName"><span class="type-signature"></span>getTypeName<span class="signature">()</span><span class="type-signature"> &rarr; {string}</span></h4>
    

    



<div class="description">
    <p>Returns type name of this BinaryObject instance.</p>
</div>













<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="BinaryObject.js.html">BinaryObject.js</a>, <a href="BinaryObject.js.html#line250">line 250</a>
    </li></ul></dd>
    

    

    

    
</dl>













<h5>Returns:</h5>

        
<div class="param-desc">
    <ul>
<li>type name.</li>
</ul>
</div>



<dl>
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">string</span>


    </dd>
</dl>

    





        
            

    

    
    <h4 class="name" id="hasField"><span class="type-signature"></span>hasField<span class="signature">(fieldName)</span><span class="type-signature"> &rarr; {boolean}</span></h4>
    

    



<div class="description">
    <p>Checks if the specified field exists in this BinaryObject instance.</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>fieldName</code></td>
            

            <td class="type">
            
                
<span class="param-type">string</span>


            
            </td>

            

            

            <td class="description last"><p>name of the field.</p></td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="BinaryObject.js.html">BinaryObject.js</a>, <a href="BinaryObject.js.html#line184">line 184</a>
    </li></ul></dd>
    

    

    

    
</dl>











<h5>Throws:</h5>

        

<dl>
    <dt>
        <div class="param-desc">
        <p>if error.</p>
        </div>
    </dt>
    <dd></dd>
    <dt>
        <dl>
            <dt>
                Type
            </dt>
            <dd>
                
<span class="param-type"><a href="IgniteClientError.html">IgniteClientError</a></span>


            </dd>
        </dl>
    </dt>
    <dd></dd>
</dl>


    


<h5>Returns:</h5>

        
<div class="param-desc">
    <ul>
<li>true if exists, false otherwise.</li>
</ul>
</div>



<dl>
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">boolean</span>


    </dd>
</dl>

    





        
            

    

    
    <h4 class="name" id="removeField"><span class="type-signature"></span>removeField<span class="signature">(fieldName)</span><span class="type-signature"> &rarr; {<a href="BinaryObject.html">BinaryObject</a>}</span></h4>
    

    



<div class="description">
    <p>Removes the specified field.
Does nothing if the field does not exist.</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>fieldName</code></td>
            

            <td class="type">
            
                
<span class="param-type">string</span>


            
            </td>

            

            

            <td class="description last"><p>name of the field.</p></td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="BinaryObject.js.html">BinaryObject.js</a>, <a href="BinaryObject.js.html#line167">line 167</a>
    </li></ul></dd>
    

    

    

    
</dl>











<h5>Throws:</h5>

        

<dl>
    <dt>
        <div class="param-desc">
        <p>if error.</p>
        </div>
    </dt>
    <dd></dd>
    <dt>
        <dl>
            <dt>
                Type
            </dt>
            <dd>
                
<span class="param-type"><a href="IgniteClientError.html">IgniteClientError</a></span>


            </dd>
        </dl>
    </dt>
    <dd></dd>
</dl>


    


<h5>Returns:</h5>

        
<div class="param-desc">
    <ul>
<li>the same instance of BinaryObject</li>
</ul>
</div>



<dl>
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type"><a href="BinaryObject.html">BinaryObject</a></span>


    </dd>
</dl>

    





        
            

    

    
    <h4 class="name" id="setField"><span class="type-signature"></span>setField<span class="signature">(fieldName, fieldValue, fieldType<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {<a href="BinaryObject.html">BinaryObject</a>}</span></h4>
    

    



<div class="description">
    <p>Sets the new value of the specified field.
Adds the specified field, if it did not exist before.</p>
<p>Optionally, specifies a type of the field.
If the type is not specified then during operations the Ignite client
will try to make automatic mapping between JavaScript types and Ignite object types -
according to the mapping table defined in the description of the <a href="ObjectType.html">ObjectType</a> class.</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        
        <th>Attributes</th>
        

        
        <th>Default</th>
        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>fieldName</code></td>
            

            <td class="type">
            
                
<span class="param-type">string</span>


            
            </td>

            
                <td class="attributes">
                

                

                
                </td>
            

            
                <td class="default">
                
                </td>
            

            <td class="description last"><p>name of the field.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>fieldValue</code></td>
            

            <td class="type">
            
                
<span class="param-type">*</span>


            
            </td>

            
                <td class="attributes">
                

                

                
                </td>
            

            
                <td class="default">
                
                </td>
            

            <td class="description last"><p>new value of the field.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>fieldType</code></td>
            

            <td class="type">
            
                
<span class="param-type"><a href="ObjectType.html#.PRIMITIVE_TYPE">ObjectType.PRIMITIVE_TYPE</a></span>
|

<span class="param-type"><a href="CompositeType.html">CompositeType</a></span>


            
            </td>

            
                <td class="attributes">
                
                    &lt;optional><br>
                

                

                
                </td>
            

            
                <td class="default">
                
                    null
                
                </td>
            

            <td class="description last"><p>type of the field:</p>
<ul>
<li>either a type code of primitive (simple) type</li>
<li>or an instance of class representing non-primitive (composite) type</li>
<li>or null (or not specified) that means the type is not specified.</li>
</ul></td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="BinaryObject.js.html">BinaryObject.js</a>, <a href="BinaryObject.js.html#line148">line 148</a>
    </li></ul></dd>
    

    

    

    
</dl>











<h5>Throws:</h5>

        

<dl>
    <dt>
        <div class="param-desc">
        <p>if error.</p>
        </div>
    </dt>
    <dd></dd>
    <dt>
        <dl>
            <dt>
                Type
            </dt>
            <dd>
                
<span class="param-type"><a href="IgniteClientError.html">IgniteClientError</a></span>


            </dd>
        </dl>
    </dt>
    <dd></dd>
</dl>


    


<h5>Returns:</h5>

        
<div class="param-desc">
    <ul>
<li>the same instance of BinaryObject</li>
</ul>
</div>



<dl>
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type"><a href="BinaryObject.html">BinaryObject</a></span>


    </dd>
</dl>

    





        
            

    

    
    <h4 class="name" id="toObject"><span class="type-signature">(async) </span>toObject<span class="signature">(complexObjectType)</span><span class="type-signature"> &rarr; {object}</span></h4>
    

    



<div class="description">
    <p>Deserializes this BinaryObject instance into an instance of the specified complex object type.</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>complexObjectType</code></td>
            

            <td class="type">
            
                
<span class="param-type"><a href="ComplexObjectType.html">ComplexObjectType</a></span>


            
            </td>

            

            

            <td class="description last"><p>instance of class representing complex object type.</p></td>
        </tr>

    
    </tbody>
</table>






<dl class="details">

    

    

    

    

    

    

    

    

    

    

    

    

    
    <dt class="tag-source">Source:</dt>
    <dd class="tag-source"><ul class="dummy"><li>
        <a href="BinaryObject.js.html">BinaryObject.js</a>, <a href="BinaryObject.js.html#line227">line 227</a>
    </li></ul></dd>
    

    

    

    
</dl>











<h5>Throws:</h5>

        

<dl>
    <dt>
        <div class="param-desc">
        <p>if error.</p>
        </div>
    </dt>
    <dd></dd>
    <dt>
        <dl>
            <dt>
                Type
            </dt>
            <dd>
                
<span class="param-type"><a href="IgniteClientError.html">IgniteClientError</a></span>


            </dd>
        </dl>
    </dt>
    <dd></dd>
</dl>


    


<h5>Returns:</h5>

        
<div class="param-desc">
    <ul>
<li>instance of the JavaScript object
which corresponds to the specified complex object type.</li>
</ul>
</div>



<dl>
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">object</span>


    </dd>
</dl>

    





        
    

    

    
</article>

</section>




</div>

<nav>
    <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="BinaryObject.html">BinaryObject</a></li><li><a href="CacheClient.html">CacheClient</a></li><li><a href="CacheConfiguration.html">CacheConfiguration</a></li><li><a href="CacheEntry.html">CacheEntry</a></li><li><a href="CacheKeyConfiguration.html">CacheKeyConfiguration</a></li><li><a href="CollectionObjectType.html">CollectionObjectType</a></li><li><a href="ComplexObjectType.html">ComplexObjectType</a></li><li><a href="CompositeType.html">CompositeType</a></li><li><a href="Cursor.html">Cursor</a></li><li><a href="EnumItem.html">EnumItem</a></li><li><a href="IgniteClient.html">IgniteClient</a></li><li><a href="IgniteClientConfiguration.html">IgniteClientConfiguration</a></li><li><a href="IgniteClientError.html">IgniteClientError</a></li><li><a href="IllegalStateError.html">IllegalStateError</a></li><li><a href="LostConnectionError.html">LostConnectionError</a></li><li><a href="MapObjectType.html">MapObjectType</a></li><li><a href="ObjectArrayType.html">ObjectArrayType</a></li><li><a href="ObjectType.html">ObjectType</a></li><li><a href="OperationError.html">OperationError</a></li><li><a href="Query.html">Query</a></li><li><a href="QueryEntity.html">QueryEntity</a></li><li><a href="QueryField.html">QueryField</a></li><li><a href="QueryIndex.html">QueryIndex</a></li><li><a href="ScanQuery.html">ScanQuery</a></li><li><a href="SqlFieldsCursor.html">SqlFieldsCursor</a></li><li><a href="SqlFieldsQuery.html">SqlFieldsQuery</a></li><li><a href="SqlQuery.html">SqlQuery</a></li><li><a href="Timestamp.html">Timestamp</a></li></ul>
</nav>

<br class="clear">

<footer>
    Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Tue May 22 2018 12:08:48 GMT+0300 (Russia TZ 2 Standard Time)
</footer>

<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>